package com.warm.base.design.b_visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Date: 2019/11/27 15:22
 * @Author: LChuang
 * @Description:
 */
public class ObjectStructure {

    private List<Element> elements = new ArrayList<>();

    public ObjectStructure(){
        elements.add(new ConcreteElementA("经理A"));
        elements.add(new ConcreteElementB("工程师A"));
        elements.add(new ConcreteElementB("工程师B"));
    }

    public void show(Visitor visitor){
        for (Element element : elements){
            element.accept(visitor);
        }
    }
}
